{{>licenseInfo}}
package {{invokerPackage}};

{{#x-helidon-v3}}import java.util.concurrent.ExecutionException;
{{/x-helidon-v3}}

import io.helidon.common.GenericType;
{{#x-helidon-v3}}import io.helidon.common.reactive.Single;
import io.helidon.webclient.WebClientResponse;
{{/x-helidon-v3}}{{!
}}{{^x-helidon-v3}}import io.helidon.webclient.api.HttpClientResponse;
{{/x-helidon-v3}}

{{#appName}}
/**
 * Generic-typed response.
 *
 * Return type for generated API methods.
 *
 * @param <T> type of the return value from the generated API method
 */
{{/appName}}
public interface ApiResponse<T> {

  static <T> ApiResponse<T> create(GenericType<T> responseType, {{#x-helidon-v3}}Single<WebClientResponse>{{/x-helidon-v3}}{{^x-helidon-v3}}HttpClientResponse{{/x-helidon-v3}} webClientResponse) {
    return new ApiResponseBase<>(responseType, webClientResponse);
  }

  /**
   * @returns reactive access to the {@link {{#x-helidon-v3}}Web{{/x-helidon-v3}}{{^x-helidon-v3}}Http{{/x-helidon-v3}}ClientResponse} describing the response from the server
   */
  {{#x-helidon-v3}}Single<WebClientResponse>{{/x-helidon-v3}}{{^x-helidon-v3}}HttpClientResponse{{/x-helidon-v3}} webClientResponse();

  /**
   * @return {{#x-helidon-v3}}reactive {{/x-helidon-v3}}access to the value returned in the response from the server
   */
  {{#x-helidon-v3}}Single<T>{{/x-helidon-v3}}{{^x-helidon-v3}}T{{/x-helidon-v3}} result(){{#x-helidon-v3}} throws ExecutionException, InterruptedException{{/x-helidon-v3}};
}
